<script>
let defaultOptions = {
    headers: {
        'Accept': '*/*',
        'Content-Type': 'application/json',
        'Cache-Control': 'no-cache'
    },
    method: 'GET'
};

let myOptions = {
    headers: { 'token': 'EyxBFRXbtZIvByGpmsmmcMXaXKlwiVdh' },
    params: { 'id': 13, 'status': 2 },
    method: 'POST'
};

let mergedOptionsObjectAssign = Object.assign({}, defaultOptions);
mergedOptionsObjectAssign.headers = Object.assign({}, defaultOptions.headers, myOptions.headers);
mergedOptionsObjectAssign.method = myOptions.method || defaultOptions.method;
mergedOptionsObjectAssign.params = myOptions.params || {};

console.log(mergedOptionsObjectAssign);

    let mergedOptionsSpreadOperator = {
   ...defaultOptions,
    headers: {
       ...defaultOptions.headers,
       ...myOptions.headers
    },
    method: myOptions.method || defaultOptions.method,
    params: myOptions.params || {}
};

console.log(mergedOptionsSpreadOperator);
</script>